<?php

namespace api\modules\v1\controllers;
use Yii;
use api\common\controllers\UserController as U;

class UcenterController extends U
{
    public $modelClass = 'api\modules\v1\models\Ucenter';


    public function actions()
    {
        $actions = parent::actions();
        unset($actions['index'],$actions['update'], $actions['create'], $actions['delete'], $actions['view']); //卸载操作
        return $actions;
    }
    /*
     * 头部信息
     */
    public function actionHeader(){
        $model = new $this->modelClass();
        $data = $model->layout_info();
        return $data;
    }

    /*
     * 首页显示
     */
    public function actionIndex()
    {
        $model = new $this->modelClass();
        $data = $model->getIndex();
        return $data;
    }

    /*
     * 文章显示
     */
    public function actionArticle()
    {
        $model = new $this->modelClass();
        $data = $model->getArticle();
        return $data;
    }

    /*
     * 粉丝列表
     */
    public function actionFans(){
        $model = new $this->modelClass();
        $data = $model->getFansList();
        return $data;
    }

    /*
     * 取消互粉
     */
    public function actionFansdel(){
        $model = new $this->modelClass();
        $data = $model->FansDel(Yii::$app->request->post('to_user',''));
        return $data;
    }

    /*
     * 再次关注
     * @param $aid
     * @return array
     */
    public function actionFansadd(){
        $model = new $this->modelClass();
        $data = $model->FansAdd(Yii::$app->request->post('to_user',''));
        return $data;
    }

    /*
     * 关注列表
     */
    public function actionAttention(){
        $model = new $this->modelClass();
        $data = $model->getAttentionList();
        return $data;
    }

    /*
     * 取消关注
     */
    public function actionAttentiondel(){
        $model = new $this->modelClass();
        $data = $model->AttentionDel(Yii::$app->request->post('to_user',''));
        return $data;
    }

    /*
     * 再次关注
     */
    public function actionAttentionadd(){
        $model = new $this->modelClass();
        $data = $model->AttentionAdd(Yii::$app->request->post('to_user',''));
        return $data;
    }


    /*
     * 访客列表
     * @return mixed
     */
    public function actionVisitor(){
        $model = new $this->modelClass();
        $data = $model->Visitor();
        return $data;
    }

    /*
     * 取消关注
     */
    public function actionVisitordel(){
        $model = new $this->modelClass();
        $data = $model->VisitorFansDel(Yii::$app->request->post('to_user',''));
        return $data;
    }

    /*
     * 再次关注
     */
    public function actionVisitoradd(){
        $model = new $this->modelClass();
        $data = $model->VisitorFansAdd(Yii::$app->request->post('to_user',''));
        return $data;
    }

    /*
     * 留言列表
     * @return mixed
     */
    public function actionComment(){
        $model = new $this->modelClass();
        $data = $model->CommentList();
        return $data;
    }

    /*
     * 访客数量
     * @return mixed
     */
    public function actionHits(){
        $model = new $this->modelClass();
        $data = $model->VisitorHits();
        return $data;
    }
}